<template>
    <div>
         <div class="head">
            <img src="../assets/iamges/2.png" alt="">
            <div class="submit">
                <div class="boot">
                    <input type="text" placeholder="请输入用户名" name="username" v-model="form.username">
                    <input type="text" placeholder="请输入密码" name="pwd" v-model="form.password">
                </div>
                <div class="login" @click="go">登录</div>
                <div class="wen">
                    <input type="checkbox" name="fuxuan" checked>
                    <p>我已阅读并同意 《乐康养老用户协议》《隐私政策》</p >
                </div>
                <p class="wang_pwd">忘记密码</p >
            </div>
        </div>
    </div>
</template>
<script>
function adapter() {
    //获取布局视口宽度，因为开启了理想视口，布局视口=设备横向独立像素值
    const dpWidth = document.documentElement.clientWidth
    //计算根字体大小
    const rootFonstSize = (dpWidth * 100) / 1125
    //设置根字体大小
    document.documentElement.style.fontSize = rootFonstSize + 'px'
}
adapter()
window.onresize = adapter
export default {
    name:'login',
    data () {
        return {
            form:{
                username:'',
                password:''
            },
        }
    },
    methods: {
        go(){
            if(!this.form.username){
                alert("请输入用户名")
                return
            };
            if(!this.form.password){
                alert("请输入密码")
                return
            };
           
            this.$store.dispatch('loginAsync',this.form)
        }
    }
}
</script>
<style lang="less">
@import url('../assets/css/LoginView.less');
</style>